public class StringComparison{
  public static void main(String[] args){
    String str1 = "Dhahran";
    String str2 = "Dhahran";
    String str3 = new String("Dhahran");
    
    System.out.println("str1 == str2 is " +  (str1 == str2));
    System.out.println("str1 == str3 is " + (str1 == str3));
    System.out.println("str1.equals(str3) is " + str1.equals(str3));
    System.out.println();
    String str4 = "Abha";
    String str5 = "Riyadh";
    
    System.out.println("str1.compareTo(str3)is " + str1.compareTo(str3));
    System.out.println("str1.compareTo(str4)is " + str1.compareTo(str4));
    System.out.println("str1.compareTo(str5)is " + str1.compareTo(str5));
    System.out.println();
    System.out.println("\"Dhahran\".compareTo(\"DHAHRAN\") is " + "Dhahran".compareTo("DHAHRAN"));
    System.out.println("\"Dhahran\".compareToIgnoreCase(\"DHAHRAN\") is " + "Dhahran".compareToIgnoreCase("DHAHRAN"));
   }
 }